	//生成图形验证码,写在layui.use外面才有效
	var verifyCode = new GVerify("LAY-user-get-vercode");//用户名登录的图形验证码
	layui.use(['form','element','jquery','layer'],function(){
	//获取form表单
	var form = layui.form,
	element = layui.element,
	$ = layui.$,
	layer = layui.layer;

	
	//自定义校验规则
	form.verify({
		
	});
	
	//监听用户名登录提交，data为所监听对象的数据
	form.on('submit(LAY-user-login-submit)',function(obj){
		//获取表单的值
		var field = obj.field,
		cellphone = field.cellphone,				//手机号
		imgvercode = field.imgvercode,				//图形验证码
		msgvercode = field.msgvercode;				//短信验证码
		
		
		//校验图形验证码
		var res = verifyCode.validate(imgvercode);
		if(res){
		//alert("验证正确");
		}else{
			layer.msg('验证码错误',{icon:2});
			return false;
		}
		
		//发送请求
		$.ajax({
			url:urlHead + ""//服务器端地址
			,async:true
			,type:"post"
			,data:{}
			,success:function(data){
				layer.msg('登录成功',{icon:6});
			}
			,error:function(){
				layer.msg('登录失败',{icon:5});
			}
			,dataType:"json"
		});
	});
});